package br.com.iswe.recipemaster.gwt.main.client;

import br.com.iswe.gwt.ui.client.BaseMenu;
import br.com.iswe.gwt.ui.client.SecurityMenuItem;
import br.com.iswe.recipemaster.gwt.recipe.client.RecipeCrudPanel;

import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.ui.MenuBar;
import com.google.gwt.user.client.ui.RootPanel;

public class RmMenu extends BaseMenu {

	SecurityMenuItem[] itensWebSecurity = new SecurityMenuItem[]{
			new SecurityMenuItem("RECIPE", "Recipe", 				
					new Command(){public void execute() {mainModule.showUseCase(new RecipeCrudPanel());}}),
					
	};
	
	
	
	private MainModule mainModule;
	
	public RmMenu(MainModule mainModule) {
		this.mainModule = mainModule;
	}
	
	public void buildMenu(){
		//Linha do Menu
		MenuBar menu = new MenuBar();
		
		//### adiciona os modulos ###//
		
		//Web Security
		MenuBar menuWebSecurity = new MenuBar(true);
		buildMenu(menuWebSecurity, itensWebSecurity);
		menu.addItem("Web Security", menuWebSecurity);

		
		
		//Adiciona a pagina.
		RootPanel.get(MENU).clear();
		RootPanel.get(MENU).add(menu);
	}
}
